﻿namespace Digitalmes.Application.Mes;

public sealed class ProdArchiveDto : Dto
{
    /// <summary>
    /// 产线 Id。
    /// </summary>
    public long LineId { get; set; }

    /// <summary>
    /// 产线编号
    /// </summary>
    [NotNull, StringLength(32)]
    public string? LineCode { get; set; }

    /// <summary>
    /// 工位 Id。
    /// </summary>
    public long OpId { get; set; }

    /// <summary>
    /// 工位编号
    /// </summary>
    [NotNull, StringLength(32)]
    public string? OpCode { get; set; }

    /// <summary>
    /// 工序 Id。
    /// </summary>
    public long ProcId { get; set; }

    /// <summary>
    /// 工序编号
    /// </summary>
    [NotNull, StringLength(32)]
    public string? ProcCode { get; set; }

    /// <summary>
    /// SN
    /// </summary>
    public string? Sn { get; set; }

    /// <summary>
    /// 产品编号
    /// </summary>
    public string? ProductCode { get; set; }

    /// <summary>
    /// 工单号
    /// </summary>
    public string? Wo { get; set; }

    /// <summary>
    /// 过站结果
    /// </summary>
    public PassResultEnum PassResult { get; set; }

    public string? PassResultDesc => PassResult.Description();

    /// <summary>
    /// 程序配方号
    /// </summary>
    public string? FormualNo { get; set; }

    /// <summary>
    /// 操作人员
    /// </summary>
    public string? Operator { get; set; }

    /// <summary>
    /// 班次
    /// </summary>
    public string? Shift { get; set; }

    /// <summary>
    /// RFID 编号
    /// </summary>
    public string? Rfid { get; set; }

    /// <summary>
    /// 用时(秒)
    /// </summary>
    public double CycleTime { get; set; }

    /// <summary>
    /// 进站时间
    /// </summary>
    public DateTime? InboundTime { get; set; }

    /// <summary>
    /// 出站/存档时间
    /// </summary>
    public DateTime ArchiveTime { get; set; }

    /// <summary>
    /// 数据版本。
    /// </summary>
    public long Version { get; set; }

    /// <summary>
    /// 过程数据集合
    /// </summary>
    /// <remarks>此处需定义为 JSON，与实体对应</remarks>
    [SugarColumn(IsJson = true)]
    public List<ArchiveDataItem>? Data { get; set; }

    /// <summary>
    /// 过程数据明细
    /// </summary>
    public List<ArchiveDataItemDto>? Details { get; set; }
}
